package com.hailiao.beidou.message.data.store.data

import com.hailiao.beidou.comm.serialport.constant.BaudRate
import com.hailiao.beidou.comm.serialport.constant.DataBits
import com.hailiao.beidou.comm.serialport.constant.Parity
import com.hailiao.beidou.comm.serialport.constant.StopBits
import com.hailiao.beidou.comm.serialport.data.SPConfig
import kotlinx.serialization.Serializable

/**
 * 串口配置信息
 * @Author d10ng
 * @Date 2024/3/7 10:33
 */
@Serializable
data class SPSettingData(
    var rnPath: String = "",
    var rnBaudRate: BaudRate = BaudRate.V115200,
    var rnDataBits: DataBits = DataBits.V8,
    var rnParity: Parity = Parity.NONE,
    var rnStopBits: StopBits = StopBits.V1,
    var rnPowerPath: String = "",
    var rdPath: String = "",
    var rdBaudRate: BaudRate = BaudRate.V115200,
    var rdDataBits: DataBits = DataBits.V8,
    var rdParity: Parity = Parity.NONE,
    var rdStopBits: StopBits = StopBits.V1,
    var rdPowerPath: String = "",
) {
    fun toSPConfig(): SPConfig = SPConfig(rdPath, rdBaudRate, rdDataBits, rdParity, rdStopBits)
}